
ifeq (${debug},yes)
	DEFINES += DEBUG=1
endif

include ${MAKE_SPEC_PATH}/arch.mk

ifeq (${BOOST_COMPATIBLE},yes)
	DEFINES += BOOST_OLD=1
endif
ifeq (${USE_CUDA},yes)
	DEFINES += ORK_CUDA_INCL=1
endif
ifeq (${CUDA_EMU},yes)
	DEFINES += ORK_CUDA_EMU=1
endif
ifeq (${USE_MKL},yes)
	DEFINES += ORK_MKL_INCL=1
endif
ifeq (${MKL_EMU},yes)
	DEFINES += ORK_MKL_EMU=1
endif
ifeq (${USE_OMP},yes)
	DEFINES += ORK_USE_OMP=1
	CFLAGS += -fopenmp
	LFLAGS += -fopenmp
endif
ifeq (${USE_MPI},yes)
	DEFINES += ORK_USE_MPI=1
endif
ifeq (${USE_PYTHON},yes)
	DEFINES += ORK_USE_PYTHON=1
endif
ifeq (${USE_GCRYPT},yes)
	DEFINES += ORK_USE_GCRYPT=1 
endif

ifeq (Linux,${OS})
	ifeq (${BOOST_COMPATIBLE},yes)
		LIBS += -lrt
	endif
else
    #DEFINES += _SCL_SECURE_NO_DEPRECATE
endif

INCLUDE_PATH += ${BOOST_PATH}
LIBS += -L${BOOST_LIB}
ifneq (${BOOST_COMPATIBLE},yes)
	LIBS += -lboost_random${XLIB_I}
endif
LIBS += -lboost_system${XLIB_I} -lboost_date_time${XLIB_I} -lboost_chrono${XLIB_I} -lboost_thread${XLIB_I} -lboost_filesystem${XLIB_I} -lboost_serialization${XLIB_I}

ifeq (${USE_MKL},yes)
	ifneq (${MKL_EMU},yes)
		INCLUDE_PATHS += ${MKL_PATH}
		LIBS += -L${MKL_LIB} -Wl${XLIB_I},-R${MKL_LIB} -lmkl_gnu_thread${XLIB_I} -lmkl_core${XLIB_I}
		ifeq (${TARGET_ARCH},64)
			LIBS += -lmkl_intel_ilp64${XLIB_I}
		else
			LIBS += -lmkl_intel${XLIB_I}
		endif
		#LIBS += -lm${XLIB_I}
	endif
endif

ifeq (${USE_CUDA},yes)
	INCLUDE_PATHS += ${CUDA_PATH}
	LIBS += -L${CUDA_LIB} -lcudart${XLIB_I} -lcublas${XLIB_I} -lcusparse${XLIB_I}
endif

ifeq (${USE_MPI},yes)
	INCLUDE_PATHS += ${MPI_PATH}
	LIBS += -L${MPI_LIB} -lmpi${XLIB_I} -lmpi_cxx${XLIB_I}
endif

ifeq (${USE_PYTHON},yes)
	INCLUDE_PATHS += ${PYTHON_PATH}
	ifeq (3,$(findstring PYTHON_VER,3))
		LIBS += -lboost_python3${XLIB_I} -lpython${PYTHON_VER}mu${XLIB_I}
	else
		LIBS += -lboost_python${XLIB_I} -lpython${PYTHON_VER}${XLIB_I}
	endif
endif

ifeq (${USE_GCRYPT},yes)
	#INCLUDE_PATHS += ${GCRYPT_PATH}
	#LIBS += -L${GCRYPT_LIB} -lgcrypt${XLIB_I}
	LIBS += -lgcrypt${XLIB_I}
endif

include ${MAKE_SPEC_PATH}/${MKSPEC}

.PHONY:
default: buildall

include ${MAKE_SPEC_PATH}/common.mk

.PHONY:
buildall: MAKEDIRS ${EXECUTABLES} ${DYN_LIBS}
